<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>图文回复</title>
<%@ include file="/WEB-INF/layouts/comm/kindeditor.jsp"%>
<%@ include file="/WEB-INF/layouts/comm/form.jsp"%>
</head>
<body>
	<div class="mod_header">
		<div class="title">
			<h2 id="h_title">编辑图文回复</h2>
		</div>
	</div>
	<ol class="breadcrumb">
		<li><a href="#">微信设置</a></li>
		<li><a href="${ctx}/webCustomer/adv/index_img">图文回复</a></li>
		<li class="active">编辑图文回复</li>
	</ol>
	<div class="mod_basic">
		<div class="title">
			<h3>编辑图文回复</h3>
		</div>

		<div class="content">
			<div class="sub_content">
				<form class="form-horizontal" action="save" id="adv_form"
					method="post">
					<input type="hidden" class="form-control" id="id" name="id"
						value="${adv.id}">
					<div class="form-group">
						<label for="examTime" class="col-sm-2 control-label">关键词：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="keyword_keyName"
								name="keyName" value="${adv.keyName}"> <span
								id="helpBlock" class="help-block">多个关键词请用空格格开：例如: 美丽 漂亮
								好看 ;</span>

						</div>
					</div>
					<div class="form-group">
						<label for="resTime" class="col-sm-2 control-label">标题*：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="title" name="title"
								value="${adv.title}">
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">排序 ：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="orderId"
								name="orderId" value="${adv == null? 1 :adv.orderId}"> <span
								id="helpBlock" class="help-block">数字，越大的排在上面;</span>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">简介：</label>
						<div class="col-sm-10">
							<textarea class="form-control" rows="3" id="info" name="info">${adv.info }</textarea>
							<span id="helpBlock" class="help-block">限制200字内;</span>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">文章所属分类：</label>
						<div class="col-sm-10">
							<select class="form-control" id="advType_id" name="advTypeId">
								<c:forEach var="advType" items="${advTypes}" varStatus="status">
									<option value="${advType.id}"
										${adv!=null?adv.advType.id == advType.id? 'selected="selected"':'':''}>${advType.title}</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">封面图片：</label>
						<div class="col-sm-10">
							<p class="form-control-static">
								<img alt="" src="${adv.imgUrl}" height="100px" width="720px"
									id="simg" /> <span id="helpBlock" class="help-block">（尺寸：宽720像素，高400像素）
									小于500k;</span>
							</p>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">封面图片地址：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="imgUrl" name="imgUrl"
								value="${adv.imgUrl}"> <span id="helpBlock"
								class="help-block">请填写图片地址</span>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">详细页是否显示封面：</label>
						<div class="col-sm-10">
							<input type="radio" id="imgShow1" name="imgShow" value="1"
								${adv == null? 'checked="checked"': adv.imgShow == 1? 'checked="checked"':''}>是
							<input type="radio" id="imgShow2" name="imgShow" value="0"
								${adv.imgShow == 0? 'checked="checked"':''}>否
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">图文详细页内容：</label>
						<div class="col-sm-10">
							<textarea name="content" id="edit_content"
								style="width: 100%; height: 400px;">${adv.content }</textarea>
						</div>
					</div>
					<div class="form-group">
						<label for="title" class="col-sm-2 control-label">图文外链网址：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="wUrl" name="wUrl"
								value="${adv.wUrl}"> <span id="helpBlock"
								class="help-block">如需跳转到其他网址，请在这里填写网址(例如：http://baidu.com，记住必须有http://)如果填写了图文详细内容，这里请留空，不要设置！</span>

						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="submit" class="btn btn-primary">保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<footer_body> <script>
		base.menu.active('menu_102');
		base.kindeditor.init('${ctx}', '#edit_content');
		base.form.validation("#adv_form", {
			rules : {
				title : {
					required : true
				},
				imgUrl : {
					required : true
				},
				orderId : {
					required : true,
					digits : true
				},
				info : {
					maxlength : 200
				}
			},
			ignore : ""
		});

		base.form
				.ajaxSubmit({
					formid : '#adv_form',
					cbfun : function(data) {
						if (data.data == true) {
							BootstrapDialog
									.show({
										message : "设置成功",
										size : BootstrapDialog.SIZE_SMALL,
										buttons : [
												{
													label : '继续编辑',
													cssClass : 'btn-success',
													action : function(dialogRef) {
														window.location.href = "${ctx}/webCustomer/adv/index_img/add?id=${adv.id}";
													}
												},
												{
													label : '查看图文回复',
													cssClass : 'btn-warning',
													action : function(dialogRef) {
														window.location.href = "${ctx}/webCustomer/adv/index_img";
													}
												} ]
									});
						} else {
							BootstrapDialog.alert("保存失败，请重试");
						}
					}
				});
	</script> </footer_body>
</body>
</html>